@*
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*@
@import scalaz.{\/}
@(cluster:String, errorOrConsumers: kafka.manager.ApiError \/ kafka.manager.ConsumerListExtended
)(implicit af: features.ApplicationFeatures, messages: play.api.i18n.Messages, menus: models.navigation.Menus, request:RequestHeader)

@theMenu = {
    @views.html.navigation.clusterMenu(cluster,"Consumer","List",menus.clusterMenus(cluster)(
        errorOrConsumers.toOption.map(_.clusterContext.clusterFeatures).getOrElse(kafka.manager.features.ClusterFeatures.default)))
}

@consumerScripts = {
    <script type="text/javascript">
    $(document).ready(function() {
        $('#consumer-table').DataTable(
                {
                    "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
                }
        );
    } );
    </script>
}

@main(
    "Consumer List",
    menu = theMenu,
    breadcrumbs=views.html.navigation.breadCrumbs(models.navigation.BreadCrumbs.withViewAndCluster("Consumers",cluster)),
    scripts=consumerScripts) {
    <div class="col-md-12">
        <div class="card">
            <div class="card-header"><h3>Consumers</h3></div>
            <div class="card-body">
            @errorOrConsumers.fold(
                views.html.errors.onApiError(_),
                cl => views.html.consumer.consumerListContent(cluster,cl.list,cl.clusterContext))
            </div>
        </div>
    </div>
}
